package jzqb.common;
import lombok.Data;

import java.io.Serializable;
//public class CwResult {
//}
@Data
public class AdminResult implements Serializable {
    private int code;
    private String msg;
    private Object data;
    private int state;

    public static AdminResult ok(Object data) {
        AdminResult m = new AdminResult();
        m.setCode(0);
        m.setData(data);
        m.setMsg("操作成功");
        return m;
    }

    public static AdminResult bad(String msg) {
        AdminResult m = new AdminResult();
        m.setCode(0);
        m.setData(null);
        m.setMsg(msg);
        return m;
    }

    public static AdminResult loginOk(Object data) {
        AdminResult m = new AdminResult();
        m.setCode(200);
        m.setData(data);
        m.setState(0);
        m.setMsg("登录成功");
        return m;
    }

    public static AdminResult loginBad(String msg) {
        AdminResult m = new AdminResult();
        m.setCode(0);
        m.setData(null);
        m.setState(-1);
        m.setMsg(msg);
        return m;
    }

    public static AdminResult logoutOk(Object data) {
        AdminResult m = new AdminResult();
        m.setCode(0);
        m.setData(data);
        m.setMsg("退出成功");
        return m;
    }


    public static AdminResult timeout(String msg) {
        AdminResult m = new AdminResult();
        m.setCode(1001);
        m.setData(null);
        m.setMsg(msg);
        return m;
    }


}